package com.niit.white_box.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import java.util.Random;

@Service
public class SmsService {
    private static final Logger log = LoggerFactory.getLogger(SmsService.class);

    public String generate6DigitCode() {
        return String.format("%06d", new Random().nextInt(1000000));
    }

    public void sendResetCode(String phone, String code) {
        // TODO: 接入真实短信服务商
        log.info("模拟发送短信到 {} 验证码: {}", phone, code);
        // 便于本地调试：直接在控制台打印，确保在 IDEA 的 Run/Debug 面板可见
        System.out.println("[DEV] 重置验证码 -> phone=" + phone + ", code=" + code);
    }
}


